package org.example.mapper;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.example.pojo.Depts;

import java.util.List;

@Mapper
public interface DeptsMapper {

    @Select("select * from dept")
    List<Depts> list();

    @Delete("delete from dept where id = #{id}")
    void delete(Integer id);

    @Insert("insert into dept(name,create_time,update_time) value(#{name},now(),now())")
    void add(Depts depts);


    @Select("select * from dept where id = #{id}")
    Depts getById(Integer id);

    @Insert("update dept set name = #{name},update_time = now() where id = #{id}")
    void update(Depts depts);
}
